#include "systreedirmodel.h"
#include <QFileSystemModel>
#include <QFileIconProvider>
#include "Share/dbSqlGlobal.h"

CNS_SYS_REGISTER(SysTreeDirModel)

SysTreeDirModel::SysTreeDirModel()
{

}


void SysTreeDirModel::f_createView(CnsComponentPtr com, CnsComponentPtr mainView)
{
    CnsFileSystemModelPtr model = com->propertyInNs("model").value<CnsFileSystemModelPtr>();
    const QString &rootPath = com->propertyInNs("rootPath").toString();
    model->setRootPath(rootPath);
    model->iconProvider()->setOptions(QFileIconProvider::DontUseCustomDirectoryIcons);
    const QString &suffix = com->propertyInNs("suffix").toString();
//    model->setNameFilters(QStringList() << suffix);

    CnsSortFilterProxyModelPtr proxyModel = com->propertyInNs("proxyModel").value<CnsSortFilterProxyModelPtr>();
    proxyModel->setRecursiveFilteringEnabled(true);
//    proxyModel->setFilterRole(QFileSystemModel::FileNameRole);
//    proxyModel->setFilterWildcard(suffix);
}
